<template>
	<view class="contents">
    <view class="article">
      <view class="article-item">
        <view class="article-item__container">
          <view class="article-item__header">
            <view class="article-item__icon">
              <image src="/static/logo.png" mode="scaleToFill" class="article-item__icon-img"></image>
            </view>
          </view>
          <view class="article-item__content article-item__content--center">
            <text class="article-item__content-title">群昵称</text>
            <text class="article-item__content-note">2023-08-11 12:31</text>
          </view>
        </view>
        <view class="article-item_text">喜多川魅魔</view>
        <view class="article-item_img-grid">
          <u-upload ref="uUpload" 
          :file-list="fileList" 
          :show-progress="false" 
          width="219" 
          height="219" 
          :deletable="false" 
          :custom-btn="true"
          ></u-upload>
        </view>
      </view>
    </view>
    
    <view class="Article-num u-flex">
      <view class="u-flex u-m-r-20">
        <iconfont name="icon-shoucang" class="Article-num_img"></iconfont>
        <view>9999</view>
      </view>
      <view class="u-flex">
        <iconfont name="icon-liulan" class="Article-num_img"></iconfont>
        <view>9999</view>
      </view>
      <view class="u-flex Article-num_r">
        <iconfont name="icon-jiabahuo" class="Article-num_img"></iconfont>
        <view>9999</view>
      </view>
    </view>
		<view class="comment-item">
      <view class="comment-p">
        <input type="text" placeholder="写下你的评论" class="comment-input" />
      </view>
      <view class="comment-btn">
        <iconfont name="icon-biaoqingbao" class="emote"></iconfont>
        <view class="comment-btn_submit">发送</view>
      </view>
		  <view class="comment" v-for="(res, index) in commentList" :key="res.id">
		  	<view class="left"><image :src="res.url" mode="aspectFill"></image></view>
		  	<view class="right">
		  		<view class="top">
		  			<view class="name">{{ res.name }}</view>
            <view class="recover">回复</view>
		  		</view>
		  		<view class="content">{{ res.contentText }}</view>
		  		<view class="reply-box">
		  			<view class="item" v-for="(item, index) in res.replyList" :key="item.index">
		  				<view class="username">{{ item.name }}</view>
		  				<view class="text">{{ item.contentStr }}</view>
		  			</view>
		  		</view>
		  		<view class="bottom">
		  			{{ res.date }}
		  		</view>
		  	</view>
		  </view>
      <view class="load-more-wrap">
        <view class="line"></view>
        <view class="load-more-inner">UP主已关闭评论功能</view>
        <view class="line"></view>
      </view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			commentList: [],
      fileList:[],
		};
	},
	onLoad(options) {
    uni.setNavigationBarTitle({
      title: options.Name
    });
    this.Name = options.Name
		this.getComment();
    
    let arr = [];
    for (let i = 1; i <= 9; i++) {
      arr.push({'url': '/static/image/mm'+i+'.png'});
    }
    this.fileList = arr
	},
	methods: {
		// 评论列表
		getComment() {
			this.commentList = [
				{
					id: 1,
					name: '叶轻眉',
					date: '12-25 18:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
					allReply: 12,
					likeNum: 33,
					isLike: false,
					replyList: [
						{
							name: 'uview',
							contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
						},
						{
							name: '粘粘',
							contentStr: '今天吃什么，明天吃什么，晚上吃什么，我只是一只小猫咪为什么要烦恼这么多'
						}
					]
				},
				{
					id: 2,
					name: '叶轻眉1',
					date: '01-25 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					allReply: 0,
					likeNum: 11,
					isLike: false,
					url: 'https://cdn.uviewui.com/uview/template/niannian.jpg',
				},
				{
					id: 3,
					name: '叶轻眉2',
					date: '03-25 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					allReply: 0,
					likeNum: 21,
					isLike: false,
					allReply: 2,
					url: '../../../static/logo.png',
					replyList: [
						{
							name: 'uview',
							contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
						},
						{
							name: '豆包',
							contentStr: '想吃冰糖葫芦粘豆包，但没钱5555.........'
						}
					]
				},
				{
					id: 4,
					name: '叶轻眉3',
					date: '06-20 13:58',
					contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
					url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
					allReply: 0,
					likeNum: 150,
					isLike: false
				}
			];
		}
	}
};
</script>

<style lang="scss" scoped>
.contents{
  background-color: #ffffff;
  .article{
    .article-item{
      position: relative;
      background-color: #fff;
      cursor: pointer;
      border-radius: 28rpx;
      .article-item__container{
        position: relative;
        display: flex;
        flex-direction: row;
        flex: 1;
        overflow: hidden;
        padding: 32rpx 0 0 32rpx;
        .article-item__header {
          display: flex;
          flex-direction: row;
          align-items: center;
          .article-item__icon{
            margin-right: 18rpx;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            position: relative;
            .article-item__icon-img{
              display: block;
              height: 80rpx;
              width: 80rpx;
              margin-right: 20rpx;
              border-radius: 50%;
              overflow: hidden;
            }
          }
        }
        .article-item__content{
          display: flex;
          padding-right: 16rpx;
          flex: 1;
          color: #3b4144;
          flex-direction: column;
          justify-content: space-between;
          overflow: hidden;
          .article-item__content-title{
            font-size: 28rpx;
            color: #3b4144;
            overflow: hidden;
          }
          .article-item__content-note{
            margin-top: 8rpx;
            font-size: 24rpx;
            overflow: hidden;
          }
        }
        .article-item__content--center{
          justify-content: center;
        }
      }
      .article-item_text{
        padding: 32rpx;
      }
      .article-item_img-grid{
        padding: 0 32rpx 0 32rpx;
      } 
    }
  }
  .Article-num{
    padding:32rpx;
    .Article-num_img{
      margin-right: 10rpx;
      font-size: 48rpx;
    }
    .Article-num_r{
      margin-left: auto;
    }
  }
}
.comment-item{
  background-color: #f3f3f3;
  .comment-p{
    padding: 32rpx;
    .comment-input{
      background-color: #ffffff;
      padding: 20rpx 24rpx;
      border-radius: 24rpx;
    }
  }
  .comment-btn{
    display: flex;
    align-items: center;
    margin: 0 32rpx;
    padding-bottom: 24rpx;
    border-bottom: 4rpx solid #fff;
    .emote{
      font-size: 48rpx;
      margin-left: 24rpx;
    }
    .comment-btn_submit{
      background-color: $supernut-color;
      margin-left: auto;
      padding: 12rpx 32rpx;
      border-radius: 16rpx;
      font-size: 32rpx;
    }
  }
}
.comment {
	display: flex;
	margin:0 30rpx;
  padding: 30rpx 0;
  border-bottom: 4rpx solid #fff;
	.left {
		image {
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			background-color: #f3f3f3;
		}
	}
	.right {
		flex: 1;
		padding-left: 20rpx;
		font-size: 30rpx;
		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 10rpx;
			.name {
				color: #333333;
			}
      .recover{
        color: #ec0707;
      }
			.like {
				display: flex;
				align-items: center;
				color: #9a9a9a;
				font-size: 26rpx;
				.num {
					margin-right: 4rpx;
					color: #9a9a9a;
				}
			}
			.highlight {
				color: #5677fc;
				.num {
					color: #5677fc;
				}
			}
		}
		.content {
			margin-bottom: 10rpx;
		}
		.reply-box {
			background-color: #ffffff;
			border-radius: 12rpx;
			.item {
				padding: 20rpx;
				border-bottom: solid 2rpx $u-border-color;
				.username {
					font-size: 24rpx;
					color: #999999;
				}
			}
			.all-reply {
				padding: 20rpx;
				display: flex;
				color: #5677fc;
				align-items: center;
				.more {
					margin-left: 6rpx;
				}
			}
		}
		.bottom {
			margin-top: 20rpx;
			display: flex;
			font-size: 24rpx;
			color: #9a9a9a;
			.reply {
				color: #5677fc;
				margin-left: 10rpx;
			}
		}
	}
}
.load-more-wrap{
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  margin-bottom: 0rpx;
  margin-top: 0rpx;
  height: auto;
  padding: 32rpx 0;
  .line{
    margin: 0rpx;
    border-bottom: 2rpx solid rgb(0, 0, 0);
    width: 16rpx;
    transform: scaleY(0.5);
    border-top-color: rgb(0, 0, 0);
    border-right-color: rgb(0, 0, 0);
    border-left-color: rgb(0, 0, 0);
  }
  .load-more-inner{
    margin: 0 10rpx;
  }
}
</style>
